﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Collections;
using Microsoft.ApplicationBlocks.Data;
namespace kxjsj
{
    public partial class db_comp : Form
    {
        public OleDbConnection con_new;
        public OleDbConnection con_old;
        public string sql_new;
        public string sql_old;
        public db_comp()
        {
             InitializeComponent();
        }

        private void db_comp_Load(object sender, EventArgs e)
        {
            OleDbDataAdapter sda_new = new OleDbDataAdapter(sql_new, con_new);
            DataSet ds = new DataSet();
            sda_new.Fill(ds, "huizong");
            this.dgv_new.DataSource = ds.Tables["huizong"].DefaultView;

            OleDbDataAdapter sda_old = new OleDbDataAdapter(sql_old, con_old);
            DataSet ds2 = new DataSet();
            sda_old.Fill(ds2, "huizong");
            this.dgv_old.DataSource = ds2.Tables["huizong"].DefaultView;
        }

        private void dgv_new_Scroll(object sender, ScrollEventArgs e)
        {
            //if (e.ScrollOrientation == ScrollOrientation.HorizontalScroll)
            //    dgv_old.HorizontalScrollingOffset = e.NewValue;
        }

        private void dgv_old_Scroll(object sender, ScrollEventArgs e)
        {
            if (e.ScrollOrientation == ScrollOrientation.HorizontalScroll)
                dgv_new.HorizontalScrollingOffset = e.NewValue;
        }

        private void dgv_new_DataError(object sender, DataGridViewDataErrorEventArgs e)
        {

        }

        private void dgv_old_DataError(object sender, DataGridViewDataErrorEventArgs e)
        {

        }
    }
}
